home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c++
- Subject: Re: Beginner: How to #include
- Date: Thu, 01 Feb 1996 04:27:42 GMT
- Organization: Netcom
- Message-ID: <3110405d.31483776@nntp.ix.netcom.com>
- References: <west.32.008AC8C0@emt.e-technik.tu-muenchen.de> <00001a81+0000973a@msn.com>
- NNTP-Posting-Host: ix-dc11-20.ix.netcom.com
- X-NETCOM-Date: Wed Jan 31 8:28:11 PM PST 1996
- X-Newsreader: Forte Agent .99c/16.141
-
- Tendrils@msn.com (kelvin ) wrote:
-
- > Generally, it is best to put #includes in .cpp files
- >
- > my_data.h:
- > ----------
- > class CPicture; // forward declaration
- >
- > class A
- > {
- > ..
- > CPicture m_picture;
- > ...
- > }
- >
- >
- >
- > my_program.cpp:
- > ---------------
- > #include "my_data.h"
- >
- > Also,
- >
- > it is a very good practice to put the following two statements
- > at the top of the .h file
- >
- > #ifndef _MY_DATA_H_
- > #define _MY_DATA_H_
- >
- > and the following statement at the last line of the .h file
- > #endif
-
- It's better practice to use something like
-
- #ifndef MY_DATA_H_
- #define MY_DATA_H_
- // ...
- #endif
-
- _MY_DATA_H_ is a reserveed identifier, as are all identifiers
- beginning with an underscore and an uppercase letter (draft 2.9).
-
-
- Michael M Rubenstein
-